package cn.platform.mapper;

import cn.platform.entity.Attendance;
import cn.platform.request.AttendanceQueryDTO;
import cn.platform.request.AttendanceRequest;
import cn.platform.response.AttendanceVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface AttendanceMapper {
    // 查询
    List<Attendance> listAttendance(AttendanceRequest req);

    // 新增
    void insertAttendance(AttendanceRequest req);

    // 更新，用id找，其余参数为更新内容，null值不更新
    void updateAttendance(AttendanceRequest req);

    // 删除，用id找
    void deleteAttendance(AttendanceRequest req);

    void insert(Attendance attendance);

    Page<AttendanceVO> page(AttendanceQueryDTO attendanceQueryDTO);

    @Delete("delete from jxt_stu_attendance where id=#{id}")
    void deleteRecord(Integer id);

    void deleteBatch(List<Integer> ids);

    int deleteBeforeTime(LocalDateTime oneMonthAgo);
}
